#include <stdio.h>

#include "nvs_flash.h"
#include "esp_check.h"
#include "esp_netif.h"
#include "esp_event.h"
#include "protocol_examples_common.h"

#include "motor_server.h"
#include "motor_wifi.h"
#include "tmc2209.h"
#include "key.h"
#include "vbus_adc.h"
#include "led.h"
#include "app_storage.h"

void app_main(void)
{
    ESP_ERROR_CHECK(nvs_flash_init());
    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());

    led_init();
    led_queuesend_state(LED_ON);

    app_storage_init();

    step_motor_init();

    key_init();

    init_motor_wifi();
    init_motor_server();

    vbus_adc_init();

    led_queuesend_state(LED_OFF);
}
